/**   
 * @Title: FastDFSClientConfig.java
 * @Package com.knight.canting.core.plugin.fastdfs
 * @Description: TODO
 * @author Yi Xiaoping <thinker1013@163.com>
 * @date 2015年12月16日 下午4:16:53
 * @version V1.0   
*/

package com.fas.core.plugin.fastdfs;

import org.junit.Assert;

import com.jfinal.kit.Prop;
import com.jfinal.kit.PropKit;

/**
 * 
 * FastDFS客户端配置类
 * 
 * @Copyright: Copyright (c) 2015 Knight 
 * @anthor yixiaoping<thinker1013@163.com>
 * @since 2015年12月16日 下午4:16:53
 * @version V1.0
 */

public class FastDFSClientConfig {
	
	private String downloadUrl;
	private static FastDFSClientConfig me;
	
	public static FastDFSClientConfig me() {
		if(me == null)
			me = new FastDFSClientConfig();
		return me;
	}
	private FastDFSClientConfig(){
		init();
	}
	private void init(){
		Prop prop = PropKit.use("fdfs_client.conf");
		Assert.assertNotNull("配置文件fdfs_client.conf加载失败", prop);
		
		String url = prop.get("download_server");
		Assert.assertNotNull("配置文件fdfs_client.conf [download_server]未配置",url);
		
		if( !url.endsWith("/"))
			this.setDownloadUrl(prop.get("download_server")+"/");
		else
			this.setDownloadUrl(prop.get("download_server"));
	}
	public String getDownloadUrl() {
		return downloadUrl;
	}

	public void setDownloadUrl(String downloadUrl) {
		this.downloadUrl = downloadUrl;
	}

}
